/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.femass.model;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;


@Entity
@Table(name = "Palestrante")
@NamedQueries({
    @NamedQuery(name = "Palestrante.findAll", query = "SELECT p FROM Palestrante p"),
    @NamedQuery(name = "Palestrante.findByTitulacao", query = "SELECT p FROM Palestrante p WHERE p.titulacao = :titulacao"),
    @NamedQuery(name = "Palestrante.findByParticipantecod", query = "SELECT p FROM Palestrante p WHERE p.participantecod = :participantecod")})
public class Palestrante implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Lob
    @Column(name = "curriculo")
    private byte[] curriculo;
    private static final long serialVersionUID = 1L;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "titulacao")
    private String titulacao;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "Participante_cod")
    private Integer participantecod;
    @JoinColumn(name = "Participante_cod", referencedColumnName = "cod", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Participante participante;

    public Palestrante() {
    }

    public Palestrante(Integer participantecod) {
        this.participantecod = participantecod;
    }

    public Palestrante(Integer participantecod, String titulacao, byte[] curriculo) {
        this.participantecod = participantecod;
        this.titulacao = titulacao;
        this.curriculo = curriculo;
    }

    public String getTitulacao() {
        return titulacao;
    }

    public void setTitulacao(String titulacao) {
        this.titulacao = titulacao;
    }

    public Integer getParticipantecod() {
        return participantecod;
    }

    public void setParticipantecod(Integer participantecod) {
        this.participantecod = participantecod;
    }

    public Participante getParticipante() {
        return participante;
    }

    public void setParticipante(Participante participante) {
        this.participante = participante;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (participantecod != null ? participantecod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Palestrante)) {
            return false;
        }
        Palestrante other = (Palestrante) object;
        if ((this.participantecod == null && other.participantecod != null) || (this.participantecod != null && !this.participantecod.equals(other.participantecod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.femass.model.Palestrante[ participantecod=" + participantecod + " ]";
    }

    public byte[] getCurriculo() {
        return curriculo;
    }

    public void setCurriculo(byte[] curriculo) {
        this.curriculo = curriculo;
    }

}
